const path = require("path")
const HtmlWebpackPlugin = require("html-webpack-plugin")
const { CleanWebpackPlugin } = require('clean-webpack-plugin')

module.exports = {
  mode: "development",
  // entry: "./src/commonjs_index.js", // 可以使用相对路径
  entry: "./src/es_index.js", // 可以使用相对路径
  devtool: "source-map",
  output: {
    filename: "js/bundle.js",
    path: path.resolve(__dirname, "./dist"), // path不能使用相对路径，__dirname是当前绝对路径
  },
  plugins: [
    new CleanWebpackPlugin(),
    new HtmlWebpackPlugin({
      title: 'learn webpack',
    }),
  ]
}